// Copyright 2023 xobserve.io Team
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/* 
This panel is for demonstration purpose, it is an external plugin, auto generated by xobserve.

The origin plugin files is in https://github.com/xObserve/xobserve/tree/main/ui/external-plugins
*/

// This demo datasource is just a copy of Promtheus datasource
import { DatasourcePluginComponents } from 'types/plugin'
import DatasourceEditor from './DatasourceEditor'
import VariableEditor from './VariableEditor'
import QueryEditor from './QueryEditor'
import { DatasourceTypeHttp } from './types'
import icon from './icon.svg'
import {
  checkAndTestHttp,
  queryHttpVariableValues,
  query_http_alerts,
  replaceHttpQueryWithVariables,
  run_http_query,
} from './query_runner'

const components: DatasourcePluginComponents = {
  datasourceEditor: DatasourceEditor,
  variableEditor: VariableEditor,
  queryEditor: QueryEditor,

  // defined in query_runner.ts
  runQuery: run_http_query,
  testDatasource: checkAndTestHttp,
  replaceQueryWithVariables: replaceHttpQueryWithVariables,
  queryVariableValues: queryHttpVariableValues,

  queryAlerts: query_http_alerts,

  settings: {
    type: DatasourceTypeHttp,
    icon,
  },
}

export default components
